﻿using System.Reflection;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ColorPick;

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        properties = typeof(Colors).GetProperties().ToList();
        foreach (var property in properties)
        {
            colorDictionaries.Add(property.Name, (Color)property.GetValue(colors));
        }
    }

    private List<PropertyInfo> properties;
    private Dictionary<string, Color> colorDictionaries = new Dictionary<string, Color>();
    private Colors colors;

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        foreach (var colorDictionary in colorDictionaries)
        {
            TextBlock textBlock = new TextBlock();
            textBlock.Text = colorDictionary.Key;
            textBlock.HorizontalAlignment = HorizontalAlignment.Center;
            textBlock.VerticalAlignment = VerticalAlignment.Center;
            Border border = new Border();
            border.Background = new SolidColorBrush(colorDictionary.Value);
            border.Height = 40;
            border.Width = 120;
            border.Child = textBlock;
            border.Margin = new Thickness(5);
            border.BorderThickness = new Thickness(1);
            border.BorderBrush = new SolidColorBrush(Colors.Black);
            wrapPanel.Children.Add(border);
        }
    }
}